<!DOCTYPE html>
<html>

<head>
    <title>欢迎来到日程共享管理注册页面</title>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="${ctxPath}/assets/common/libs/layui/css/layui.css?v=${constants.getReleaseVersion()}"/>
    <link rel="stylesheet" href="${ctxPath}/assets/common/css/login.css?v=${constants.getReleaseVersion()}" media="all">
    <style>
        body {
            background: url('/assets/expand/images/logo_bg1.jpg') no-repeat;
            height: 100%;
            width: 100%;
            background-size: cover;
            position: absolute;
            overflow: hidden;
        }

        .login-header {
            color: rgba(0, 0, 0, .85) !important;
        }

        .login-footer {
            color: rgba(0, 0, 0, 0.7) !important;
        }

        .login-footer a {
            color: rgba(0, 0, 0, 0.7) !important;
        }

        .login-footer a:hover {
            color: rgba(0, 0, 0, 0.4) !important;
        }
    </style>
    <script>
        if (window != top)
            top.location.replace(location.href);
    </script>
</head>

<body>
<div class="login-wrapper">

    <div class="login-header">
        <p style="color: rgb(0,0,0);font-family: '微软雅黑 Light';font-size: x-large"><img src="${ctxPath}/assets/common/images/logo2.jpg"> L-WokH日程云共享管理系统&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注册</p>
    </div>

    <div class=" login-body">
        <div class="layui-card">
            <!--<form class="layui-form" id="userForm" lay-filter="userForm">-->
            <div class="layui-card-header">
                <i class="layui-icon layui-icon-engine"></i>&nbsp;&nbsp;用户注册
            </div>
            <form class="layui-card-body layui-form layui-form-pane" id="userForm" lay-filter="userForm" method="post">


                <div class="layui-form-item">
                    <label class="layui-form-label">账号<span style="color: red;">*</span></label>
                    <div class="layui-input-block">
                        <input name="account" placeholder="请输入您的账号" type="text" class="layui-input" lay-verify="required" required/>
                    </div>

                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">昵称<span style="color: red;">*</span></label>
                    <div class="layui-input-block">
                        <input name="name" placeholder="请输入您的昵称" type="text" class="layui-input" lay-verify="required" required/>
                    </div>
                </div>

                <div class="layui-form-item">

                    <label class="layui-form-label">密码<span style="color: red;">*</span></label>
                    <div class="layui-input-block">
                        <input name="password" placeholder="请输入密码" type="password" class="layui-input" lay-verify="required|psw" autocomplete="new-password" required/>
                    </div>

                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">重复密码<span style="color: red;">*</span></label>
                    <div class="layui-input-block">
                        <input name="rePassword" placeholder="请输入重复密码" type="password" class="layui-input" autocomplete="new-password" lay-verify="required|repsw" required/>
                    </div>

                </div>


                <div class="layui-form-item">
                    <label class="layui-form-label">邮箱<span style="color: red;">*</span></label>
                    <div class="layui-input-block">
                        <input name="email" placeholder="请输入邮箱" type="text" class="layui-input" lay-verify="required|email" autocomplete="off" required/>
                    </div>

                </div>



                <div class="layui-form-item">
                    <label class="layui-form-label">组织</label>
                    <div class="layui-input-block">
                        <input type="text" name="dept" id="dept" placeholder="请输入组织"  lay-verify="" class="layui-input">
                    </div>
                </div>


                <div class="layui-form-item">
                    <a href="${ctxPath}/login" class="layui-link pull-right">已有帐号</a>

                </div>
                <div class="layui-form-item">
                    <button class="layui-btn layui-btn-fluid" lay-filter="btnSubmit" lay-submit >注 册</button>

                </div>

            </form>
            <!--</form>-->
        </div>
    </div>

    <div class="login-footer">
        <p>© 2020 <a href="https://gitee.com/welsonlin/d03" target="_blank">日程云共享管理系统 V1.0</a></p>
    </div>
</div>

@/* 加入contextPath属性和session超时的配置 */
<script type="text/javascript">
    var Feng = {
        ctxPath: "${ctxPath}",
        version: '${constants.getReleaseVersion()}'
    };
</script>
<script type="text/javascript" src="${ctxPath}/assets/common/libs/layui/layui.js?v=${constants.getReleaseVersion()}"></script>
<script type="text/javascript" src="${ctxPath}/assets/common/js/common.js?v=${constants.getReleaseVersion()}"></script>

<script>
    layui.use(['layer', 'form','admin' , 'ax', 'index' ], function () {
        var $ = layui.jquery;
        var $ax = layui.ax;
        var layer = layui.layer;
        var form = layui.form;
        var admin = layui.admin;
        // var layedit = layui.layedit;
        var index = layui.index;

        // // 图形验证码
        // $('.login-captcha').click(function () {
        //     this.src = this.src + '?t=' + (new Date).getTime();
        // });

        // var errorMsg = "${tips!}";
        // if (errorMsg) {
        //     layer.msg(errorMsg, {icon: 5, anim: 6});
        // }



        // 添加表单验证方法
        form.verify({
            psw: [/^[\S]{6,12}$/, '密码必须6到12位，且不能出现空格'],

            repsw: function (value) {
                /*var pastest = Feng.ctxPath;*/
                if (value !== $('#userForm input[name=password]').val()) {
                    return "两次密码输入不一致";
                }
            }
        });
        // $('#submit').click(function (data) {
        form.on('submit(btnSubmit)', function (data) {
            var ajax = new $ax(Feng.ctxPath + "/register", function (data) {
                /*Feng.success("注册成功！");*/
                /*alert("恭喜您！注册成功，系统已发送邮件至您的邮箱，请注意查看。");*/
                layer.msg('恭喜您！注册成功，系统已发送邮件至您的邮箱，请注意查看。', {
                    icon: 1,//提示的样式
                    time: 3000, //2秒关闭（如果不配置，默认是3秒）//设置后不需要自己写定时关闭了，单位是毫秒
                    end:function(){
                        window.location.href = Feng.ctxPath + "/login";
                    }
                });
                // index.clearTabCache();

            }, function (data) {
                Feng.error("添加失败！" + data.responseJSON.message);
            });
            ajax.set(data.field);
            ajax.start();

            //添加 return false 可成功跳转页面
            return false;
        });
    });
</script>


</body>
</html>